<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/4/18
 * Time: 15:32
 */

namespace App\Common;

use Qiniu\Auth;
use Qiniu\Storage\UploadManager;
class Qiniuyun
{

    public function update($name){
        $accessKey = 'CwoTNa8K7695eiFmYDxp7bqikJ3aC-fWTeB3xTXV';
        $secretKey = 'qi_FlGI-XW37jfXa4iG49l4GRGIHiCoot46vRpNk';
        $bucket    = 'mxt';
        $auth = new Auth($accessKey, $secretKey);
        $token = $auth->uploadToken($bucket);
        $uploadMgr = new UploadManager();
        //----------------------------------------upload demo1 ----------------------------------------
        // 上传字符串到七牛
        list($ret, $err) = $uploadMgr->putFile($token,null, $name);
        if ($err !== null) {
            return false;
        } else {
            return $ret['key'];
        }
    }

}